package cave.renderer;

public class ShaderSource {
	
	public static String getVsSource() {
		return "uniform vec4 uViewPosScale;\n"+
			"uniform vec4 uPosScale;\n"+
			"uniform vec4 uUvPosScale;\n"+
			"uniform vec2 uRot;\n"+
			"attribute vec2 aPos;\n"+
			"attribute vec2 aUv;\n"+
			"varying vec2 vUv;\n"+
			"void main(void)\n"+
			"{\n"+
			"vUv = aUv*uUvPosScale.zw + uUvPosScale.xy;\n"+
			"vec2 rotated = vec2(aPos.x*uRot.y + aPos.y*uRot.x, -aPos.x*uRot.x + aPos.y*uRot.y);\n"+
			"vec2 scaled = rotated*uPosScale.zw + uPosScale.xy;\n"+
			"gl_Position = vec4(scaled*uViewPosScale.zw + uViewPosScale.xy, 0.0, 1.0);\n"+
			"}\n";
	}
	
	public static String getFsSource() {
		return "precision mediump float;\n" +
			"uniform vec4 uColor;\n" +
			"uniform sampler2D tex0;\n" +
			"varying vec2 vUv;\n" +
			"void main(void)\n" +
			"{\n" +
			"gl_FragColor = texture2D(tex0, vUv) * uColor;\n" +
			"}\n";
	}

}
